
import 'dart:async';
import 'package:dio/dio.dart';
import 'package:dustbin_sort/model/news_model_entity.dart';


const HOME_URL = 'http://127.0.0.1:8888/public/data.json';

class SearchDao{
	static Future<NewsModelEntity> fetch() async{
		Response response = await Dio().get(HOME_URL);
		if(response.statusCode == 200){
			return NewsModelEntity().fromJson(response.data);
		}else{
			throw Exception("fail to load data from api");
		}
	}
}